<?php

namespace App\Console\Commands\OpenShop;

use App\Enums\Check\CheckEnum;
use App\Enums\OpenShop\InvestmentPromotion\SignOrderEnum;
use App\Enums\OpenShop\InvestmentPromotion\SiteMissionEnum;
use App\Enums\OpenShop\MissionTemplateEnum;
use App\Models\Check\CheckCmbBankFlow;
use App\Models\College\CollegeTrainingOrderModel;
use App\Models\Cruise\CruiseOrderModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopMainProcessModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopOrderTagsMappingModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderPayHistoryModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSignOrderPermissionAnchorModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSiteMissionModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSpaceDesignCostMappingModel;
use App\Models\OpenShop\InvestmentPromotion\OpenShopSpaceDesignSoftOutfitMappingModel;
use App\Models\OpenShop\SiteLocation\OpenShopSiteLocationModel;
use App\Remote\Orm\OrmNewOrderRemote;
use App\Service\College\CollegeTrainOrderService;
use App\Service\OpenShop\Feishu\KfosService;
use App\Service\OpenShop\Feishu\MessageSendService;
use App\Service\OpenShop\Feishu\MessageService;
use App\Service\OpenShop\Feishu\OrganizationManageService;
use App\Service\OpenShop\Feishu\ShopTagsService;
use App\Service\OpenShop\User\RmsUserService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Config;

class RefreshOrderTags extends Command
{
    protected $signature   = 'openShop:refresh-order-tags';
    protected $description = '刷新订单标签';

    public function handle()
    {
        return ;
        // 获取筹备内的订单
        $orderNo = 'KD2023032064592308';
//        OpenShopOrderTagsMappingModel::query()->truncate();
        OpenShopSignOrderModel::query()
                              ->where('orderNo', $orderNo)
                              ->where('status', SignOrderEnum::ORDER_STATUS_OK)
                              ->get()
                              ->each(function ($item) {
                                  $this->info('orderNo:' . $item->orderNo);
//
                                  $shopTagsService = new ShopTagsService($item->orderNo);
//                                  // 更新 软装配送状态
//                                  $shopTagsService->updateSoftPayDelivery();
////                                  die;
//                                  // 更新 筹备标签
//                                  $shopTagsService->updateOrderPrepareTag();
//                                  // 更新 设计待支付状态
//                                  $shopTagsService->updateDesignPayTag();
//                                  // 更新 设备的发货状态和支付状态
//                                  $shopTagsService->updateKfosTag();
//                                  // 更新 软装支付状态
//                                  $shopTagsService->updateSoftPayTag();

                                  // 更新 商学院状态
                                  $shopTagsService->updateSchoolTag();

                                  // 更新工服状态
                                  $shopTagsService->updateWorkClothes();
                              });

    }


}
